home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
info_tip
/
vbtipday
/
nov.ini
< prev
next >
Wrap
INI File
|
1995-06-20
|
20KB
|
517 lines
[1]
Lines=1
Line1="A very easy way to add sound to a VB project is with the Beep command."
[2]
Lines=6
Line1="To '?' command can be used in the Debug window as a substitute for the 'Print'"
Line2=" command. For example,"
Line3="<CR>"
Line4=" ? LastName"
Line5="<CR>"
Line6="will print the value of the LastName variable."
[3]
Lines=2
Line1="Consider making use of constants wherever possible in your code. This will not"
Line2=" only make your programs more self-documenting, but easier to modify as well."
[4]
Lines=6
Line1="If you change the Name property of a control after you have coded an"
Line2=" event for it, you must also change the name of the event to match"
Line3=" the name of the control."
Line4="<CR>"
Line5="Note: After changing the name of the control, any events for that control will be"
Line6=" moved into the general declarations section."
[5]
Lines=2
Line1="To clear text in a Code Window from the current cursor location to the"
Line2=" end of line, press <CTRL>+<DEL>."
[6]
Lines=12
Line1="A great source of VB articles including programming tips, product reviews, etc."
Line2=" is "The Visual Basic Programmer's Journal." Their subscription address is:"
Line3="<CR>"
Line4=" Visual Basic Programmer's Journal"
Line5="<CR>"
Line6=" P.O. Box 58872"
Line7="<CR>"
Line8=" Boulder, CO 80322-8872"
Line9="<CR>"
Line10="or call"
Line11="<CR>"
Line12=" 303-678-0439."
[7]
Lines=9
Line1="VB supports the following 4 program control statements:"
Line2="<CR>"
Line3=" Do...Loop"
Line4="<CR>"
Line5=" If...Then...Else"
Line6="<CR>"
Line7=" Select Case"
Line8="<CR>"
Line9=" While...Wend"
[8]
Lines=2
Line1="If you use CompuServe, try GO VBPJFO for the Visual Basic Programmer's Journal"
Line2=" forum."
[9]
Lines=4
Line1="If you accidentally delete a control from a form, you can undelete it by"
Line2=" selecting the 'Undo' menu item from the 'Edit' menu."
Line3="<CR>"
Line4="Note: The Undo must be done immediately following the delete."
[10]
Lines=2
Line1="VB supports the UCase$ and LCase$ functions for converting strings to"
Line2=" uppercase and lowercase respectively."
[11]
Lines=2
Line1="To prevent a user from seeing what is typed into a text box (e.g. a"
Line2=" password), set the PasswordChar property to the '*' character."
[12]
Lines=6
Line1="To center a form on the screen, put the following two statements in the"
Line2=" Form_Load event:"
Line3="<CR>"
Line4=" Me.Top = (Screen.Height - Me.Height) / 2"
Line5="<CR>"
Line6=" Me.Left = (Screen.Width - Me.Width) / 2"
[13]
Lines=3
Line1="The Interval of the Timer property is measured in milliseconds."
Line2=" A common error is to set the property to 1 for a one second"
Line3=" interval. The correct value for a 1 second interval is 1000."
[14]
Lines=3
Line1="Comments are stripped out of an application when it is compiled. Thus,"
Line2=" comments do not increase the size of an EXE file. Feel free to use"
Line3=" as many as needed."
[15]
Lines=4
Line1="To put multiple statements in one line of code, use the colon as a"
Line2=" separator. For example:"
Line3="<CR>"
Line4=" For J = 1 to 10: J = J + 1: Next J"
[16]
Lines=3
Line1="To get Help on the syntax of VB functions, statements, properties,"
Line2=" events, and methods while you are working in a Code window, click on the"
Line3=" keyword and press F1."
[17]
Lines=1
Line1="A line of VB code can not span more than one line."
[18]
Lines=3
Line1="VB has an excellent on-line Help system. In fact, the entire Language Reference"
Line2=" Manual is on-line. Learning how to quickly navigate and find information in"
Line3=" the on-line help file will be very beneficial in the long run."
[19]
Lines=3
Line1="The Circle method, when provided with the correct parameters can be"
Line2=" used to draw an ellipse, arc, or pie wedge (an arc with radius lines drawn"
Line3=" at both ends)."
[20]
Lines=6
Line1="Consider using 'Option Explicit' to force explicit declaration of all variables used in an"
Line2=" application. You can automatically include an 'Option Explicit' statement in your code by"
Line3=" selecting the 'Environment' menu item from the 'Options' menu and changing the 'Require Variable"
Line4=" Declaration' option to 'Yes'."
Line5="<CR>"
Line6=" Note: 'Option Explicit' should appear in every form and code module in your application."
[21]
Lines=4
Line1="You may wish to set the 'Save Project Before Run' option to 'Yes'. This will give you"
Line2=" the opportunity to save your changes before every run, thus protecting you from unsaved"
Line3=" changes if the system were to crash."
Line4=" This variable can be found under the 'Environment' menu item in the 'Options' menu."
[22]
Lines=11
Line1="When creating a long string, use multiple lines of code so the string is easily readable"
Line2=" without having to horizontally scroll the screen. This technique is particularly useful"
Line3=" when displaying a MsgBox, InputBox, or creating an SQL string. For example:"
Line4="<CR>"
Line5=" strMsg = "This is a paragraph that is to be placed ""
Line6="<CR>"
Line7=" strMsg = strMsg && "in a message box. The text is ""
Line8="<CR>"
Line9=" strMsg = strMsg && "broken into several lines.""
Line10="<CR>"
Line11=" MsgBox strMsg"
[23]
Lines=3
Line1="Labels have automatic word wrap so don't worry about the caption of a label"
Line2=" being too long for the label's width. However, you may have to adjust the"
Line3=" height of the label."
[24]
Lines=2
Line1="To quickly see which events have code associated with them you can look at the"
Line2=" procedure list in the Code Window. Those events that have code will appear in boldface."
[25]
Lines=2
Line1="To make option buttons work as a group, enclose them in a frame. The option buttons in"
Line2=" a frame are separate from the rest of the option buttons on the form."
[26]
Lines=3
Line1="Separator bars, used to separate menu items in a drop-down menu, can add clarity to"
Line2=" menus. To add a separator bar simply put the character '-' in the Caption property"
Line3=" in the Menu Design Window."
[27]
Lines=2
Line1="You can automatically resize a Label control to fit its caption by setting the AutoSize"
Line2=" property of the control to 'True'."
[28]
Lines=2
Line1="Setting the BorderStyle, ControlBox, MaxButton, and MinButton properties do not"
Line2=" alter the appearance of the form until run time."
[29]
Lines=2
Line1="If you are using the QBColor function, try the RGB function instead. RGB provides"
Line2=" the ability to generate many, many more colors."
[30]
Lines=3
Line1="Use the drop down list box labeled 'Shortcut' in the Menu Design Window to assign"
Line2=" shortcut keys to menus. This is a nice feature that allows "power users" to navigate"
Line3=" quickly around the application."
[31]
Lines=2
Line1="Using the Show and Hide methods on a form is effectively the same as setting the"
Line2=" form's Visible property in code to True and False, respectively."
[32]
Lines=11
Line1="To limit the number of controls that VB loads into the Toolbox when it is launched,"
Line2=" do the following:"
Line3="<CR>"
Line4=" 1. Open the 'AUTOLOAD.MAK' project in your VB directory."
Line5="<CR>"
Line6=" 2. Click on any control that you do not want to load and select 'Remove File' from"
Line7=" the 'File' menu."
Line8="<CR>"
Line9=" 3. Save the project."
Line10="<CR>"
Line11="You may also add controls using the 'Add File' selection."
[33]
Lines=2
Line1="Colors are customizable in the VB development environment. To set your own colors"
Line2=" select 'Environment' from the 'Options' menu."
[34]
Lines=2
Line1="The VB statement to delete a file is 'Kill'. Be very careful when using this statement with"
Line2=" wildcard characters."
[35]
Lines=3
Line1="Use the following syntax to raise a number to the power of an exponent:"
Line2="<CR>"
Line3=" I = J ^ N"
[36]
Lines=2
Line1="Use <Ctrl> + <Down Arrow> and <Ctrl> + <Up Arrow> to move from procedure to"
Line2=" procedure in a code window."
[37]
Lines=3
Line1="Use the following statement to return the current day as a full name (Monday, Tuesday, etc.):"
Line2="<CR>"
Line3=" Format$(Now, "dddd")"
[38]
Lines=3
Line1="When using the SendKeys statement, remember that it is case sensitive. That is,"
Line2=" sending <Alt>+F is different than sending <Alt>+f. Some programs will interpret"
Line3=" <Alt>+F as <Alt>+<Shift>+f."
[39]
Lines=2
Line1="In an error handler, use the 'Resume Next' statement to cause the code to branch to"
Line2=" the line after the line that generated the error."
[40]
Lines=1
Line1="VB supports the Left$, Right$, and Mid$ commands for string manipulation."
[41]
Lines=3
Line1="Use the following command to print 'True' or 'False' based on the value of a flag:"
Line2="<CR>"
Line3=" Format$(Flag,"True/False")"
[42]
Lines=1
Line1="To get on-line help for an error press F1 when an error message box pops up."
[43]
Lines=2
Line1="When debugging a program with many nested calls, press <CTRL> + L in break"
Line2=" mode to see the list of procedure calls."
[44]
Lines=7
Line1="Use the Chr$ command to concatenate a carriage return in a string. For example:"
Line2="<CR>"
Line3=" Msg$ = "A carriage return will follow this line.""
Line4="<CR>"
Line5=" Msg$ = Msg$ && Chr$(10)"
Line6="<CR>"
Line7=" Msg$ = Msg$ && "This is the second line.""
[45]
Lines=2
Line1="If you want to enlarge a bitmap picture on a form use the Image control and set the"
Line2=" Stretch property to 'True'."
[46]
Lines=3
Line1="Consider using a lower case, 3 letter prefix when naming your controls, e.g."
Line2=" lblName, picLogo, txtEmpNbr, etc. This will make your code more much more readable"
Line3=" and maintainable."
[47]
Lines=2
Line1="To change the placement and size of forms and controls, use the Top, Left, Width, and"
Line2=" Height properties."
[48]
Lines=4
Line1="A modal form is a type of window or dialog box that requires the user to take action"
Line2=" before the user can switch to another form. To create a modal form use the following:"
Line3="<CR>"
Line4=" FormName.Show 1"
[49]
Lines=1
Line1="VB supports the Hex$ and Oct$ functions for converting numbers between notations."
[50]
Lines=2
Line1="To keep a user from minimizing or maximizing a form, set both the MinButton and"
Line2=" MaxButton properties of the form to 'False'."
[51]
Lines=2
Line1="To keep a user from resizing a form, set the BorderStyle property of the form to"
Line2=" '0-None', '1-Fixed Single', or '3-Fixed Double'."
[52]
Lines=3
Line1="To show the current time (with hours and minutes) use the following statement:"
Line2="<CR>"
Line3=" Format$(Now, "Short Time")"
[53]
Lines=3
Line1="Although you can draw graphics directly onto a form, the Line and Shape"
Line2=" controls are often an easier way to add lines, circles, and squares to a"
Line3=" form."
[54]
Lines=2
Line1="To turn the mousepointer into an hourglass, set the MousePointer property of the"
Line2=" Screen or Form to 11. Set the property back to 0 to restore the mousepointer."
[55]
Lines=3
Line1="To quickly remove all contents of a list box use the Clear method:"
Line2="<CR>"
Line3=" List1.Clear"
[56]
Lines=3
Line1="To quickly remove leading and trailing spaces from a string use the Trim$ command:"
Line2="<CR>"
Line3=" String1$ = Trim$(String1$)"
[57]
Lines=1
Line1="Remember, only controls that have the 'Align' property can be placed directly on an MDI form."
[58]
Lines=4
Line1="A status bar typically appears at the bottom of MDI forms. The status bar displays information"
Line2=" about the currently selected item or the state of the application. It can be created with a"
Line3=" picture box that has its Align property set to '2'. However, if you are using the professional"
Line4=" version of VB, the 3D Panel control works much better."
[59]
Lines=3
Line1="Controls can be moved from a form onto a frame. To do this, click on the control and"
Line2=" select 'Cut' from the 'Edit' menu. Then click on the frame and select 'Paste' from"
Line3=" the 'Edit' menu."
[60]
Lines=1
Line1="<Alt> + <F4> will close the current code window."
[61]
Lines=4
Line1="When working with the Debug Window, cut and paste functionality if fully operable."
Line2=" That is to say, you may paste a line of code into the Debug Window to execute it,"
Line3=" or you may cut a line of code from the Debug Window to paste into the Code Window"
Line4=" or another application."
[62]
Lines=4
Line1="To configure VB to automatically save your changes before running your program set the"
Line2=" auto save feature on. Select the 'Environment...' menu option from the 'Options' menu."
Line3=" Then set the 'Save Project Before Run' option to 'Yes'. This is especially useful when"
Line4=" working with the Windows API (which can crash the VB environment)."
[63]
Lines=10
Line1="To prevent more than one instance of your application from running, use the following"
Line2=" statements as the first lines in your program:"
Line3="<CR>"
Line4=" If App.PrevInstance Then"
Line5="<CR>"
Line6=" MsgBox "Program already loaded.""
Line7="<CR>"
Line8=" End "
Line9="<CR>"
Line10=" End If"
[64]
Lines=4
Line1="There is a lot of information for VB programmers available on the Internet. Check out"
Line2=" Carl 'n Gary's Visual Basic Home Page located at:"
Line3="<CR>"
Line4=" http://www.apexsc.com/vb"
[65]
Lines=3
Line1="To generate a date suitable for printing use the following Format statement:"
Line2="<CR>"
Line3=" Format$(Now, "mmmm d, yyyy")"
[66]
Lines=2
Line1="To specify the startup form, choose the 'Project' menu item from the 'Options' menu,"
Line2=" and set the 'Start Up Form' option."
[67]
Lines=4
Line1="To pass a control property as a parameter, enclose the control and property in parentheses."
Line2=" For example,"
Line3="<CR>"
Line4=" AddEmployee (txtEmpName.Text), (txtEmpNbr.Text)"
[68]
Lines=2
Line1="To shift one screen to the right and left, press <CTRL>+<PAGE DOWN> and"
Line2=" <CTRL>+<PAGE UP> respectively."
[69]
Lines=2
Line1="VB has an excellent debugging facility. Learning to efficiently use this facility"
Line2=" will pay huge dividends."
[70]
Lines=2
Line1="To quickly find text in VB press <CTRL>+F, and type in the text to search. The radio"
Line2=" buttons labeled 'Search' control the scope of the search. Press F3 to find next."
[71]
Lines=2
Line1="While in the Code Window, press <F2> to go to a list of all the procedures in your"
Line2=" project. From there, you can select a procedure to jump to."
[72]
Lines=2
Line1="Review your code and remove any unused statements before making an .EXE file. VB does"
Line2=" not remove dead code and thus it unnecessarily increases the size of your .EXE file."
[73]
Lines=3
Line1="The Caption property can be used to assign an access key to a control. Simply"
Line2=" proceed the character you want for an access key with the '&&' character. Try this"
Line3=" technique with Label controls, Command Button controls, Frame controls, etc."
[74]
Lines=3
Line1="It is good practice to change the name of a control before you start writing any event"
Line2=" procedures for it. If you change the name after you write an event, VB will not"
Line3=" rename the event properly and you will have to do so manually."
[75]
Lines=8
Line1="One way to convert any text entered into a text box to upper case is to put the"
Line2=" following code into the text box's KeyPress event:"
Line3="<CR>"
Line4=" If KeyAscii >= 97 And KeyAscii <= 122 Then"
Line5="<CR>"
Line6=" KeyAscii = KeyAscii - 32"
Line7="<CR>"
Line8=" End If"
[76]
Lines=3
Line1="Use the following statement to get the full name of the current month:"
Line2="<CR>"
Line3=" Format$(Now, "mmmm")"
[77]
Lines=6
Line1="To automatically select text in a text box when it gains focus, put the following"
Line2=" code in the GotFocus event of the text box."
Line3="<CR>"
Line4=" Text1.SelStart = 0"
Line5="<CR>"
Line6=" Text1.SelLength = 65000"
[78]
Lines=3
Line1="Use the following statement to format currency amounts suitable for printing:"
Line2="<CR>"
Line3=" Format$(GrandTotal, "Currency")"
[79]
Lines=1
Line1="For users of CompuServe try 'GO MICROSOFT'."
[80]
Lines=3
Line1="Use the integer data type whenever possible. The integer data type uses less memory"
Line2=" and is significantly faster for arithmetic operations than other numeric data types."
Line3=" It has a range of -32,768 to 32,767"
[81]
Lines=2
Line1="VB has a convenient Undo feature that can come in handy when code or a control"
Line2=" is accidently deleted."
[82]
Lines=4
Line1="The '\' operator can be used to perform integer division. Note that the result"
Line2=" is truncated and not rounded."
Line3="<CR>"
Line4="Thus, 5 \ 3 = 1."
[83]
Lines=4
Line1="To position a top-level menu item to the right side of the menu bar simply add the"
Line2=" following code to the Form_Load event:"
Line3="<CR>"
Line4=" mnuHelp.Caption = Chr$(8) && mnuHelp.Caption"
[84]
Lines=8
Line1="In order to minimize memory usage, use variable-length strings rather than fixed-length"
Line2=" strings wherever possible. That is, use the declaration:"
Line3="<CR>"
Line4=" Dim strName As String"
Line5="<CR>"
Line6="rather than the declaration:"
Line7="<CR>"
Line8=" Dim strName As String * 20"
[85]
Lines=2
Line1="Use the Form_QueryUnload event to determine how the user is shutting down the application."
Line2=" The QueryUnload event can also be used to cancel the application's termination."
[86]
Lines=4
Line1="You can make comments appear as though they were highlighted with a yellow marker"
Line2=" by changing the 'Comment Background' Environment Option to yellow in the"
Line3=" 'Environment Options' dialog box. Choose the 'Environment...' menu item from the"
Line4=" 'Options' menu to display this dialog box."
[87]
Lines=10
Line1="You can execute code before any form loads by using a 'Sub Main' routine. To use this"
Line2=" functionality perform the following 2 steps."
Line3="<CR>"
Line4=" 1) Define a subroutine called 'Main' in a global module."
Line5="<CR>"
Line6=" 2) Select the 'Project' menu item from the 'Options' menu and set the 'Start Up Form'"
Line7=" to 'Sub Main'."
Line8="<CR>"
Line9="This technique can be used, among other things, to read command line variables"
Line10=" and load different forms based on these variables."
[88]
Lines=6
Line1="To simulate command line variables being passed to an executable while testing in the"
Line2=" development environment, change the 'Command Line Argument' option in the 'Project"
Line3=" Options' dialog box."
Line4="<CR>"
Line5="Note: This dialog box is accessed by choosing the 'Project' menu item"
Line6=" from the 'Options' menu."
[89]
Lines=5
Line1="If you wish to search for a word by itself and not as part of another word (i.e. find"
Line2=" all instances of the word 'Go' and not 'Goto'), check the 'Match Whole Word Only'"
Line3=" check box in the 'Find' dialog box."
Line4="<CR>"
Line5="Note: This option is also found in the 'Replace' dialog box."
[90]
Lines=7
Line1="To include a double quote in a string, use two consecutive double quotes. For example:"
Line2="<CR>"
Line3=" MsgBox "Type ""GO"" to proceed.""
Line4="<CR>"
Line5="will print the following in the message box:"
Line6="<CR>"
Line7=" Type "GO" to proceed."
[91]
Lines=11
Line1="Consider using the reserved word Me when self-referencing a form. For"
Line2=" example,"
Line3="<CR>"
Line4=" Unload Me"
Line5="<CR>"
Line6="or"
Line7="<CR>"
Line8=" Me.Top = (Screen.Height - Me.Height) / 2"
Line9="<CR>"
Line10="This will make your code more portable. Thus, copying and pasting code from"
Line11=" one application to another will require fewer changes."
[92]
Lines=2
Line1="To quickly get on-line help for a particular property, click on the property in"
Line2=" the Properties Window and press F1."